package com.stx.test.encapsulation;

/**
 * packageName com.stx.test
 * 封装-账户余额修改
 * @author YangYi
 * @className BankAccount
 * @date 2025/9/13
 * @description TODO
 */
public class BankAccount {
    // 账户余额
    private double balance;
    public String name;
    String account;

    /**
     *
     * @param accName
     */
    public void getBankAccountInfo(String accName){
        if(name == accName){
        System.out.println("账号名字："+name+"，账号为："+account+"，账户余额："+balance);
        }else {
            System.out.println("输入账户名错误！");
        }
    }

    public double getBalance() {
        return balance;
    }
    public void setBalance(double ba) {
        if(ba <= 0 || ba > 100000) {
            System.out.println("一次存入的金额不能小于0或大于10万");
        }else {
            balance = ba;
        }
    }
}
